<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>
    <script type="text/javascript" src="${ctx}/appjs/ugs/ugsMemberSuperLevel.js"></script>
    <link rel="stylesheet" href="${ctx}/statics/css/update.css">
    <link rel="stylesheet" href="${ctx}/statics/css/common.css">
    <link rel="stylesheet" href="${ctx}/libjs/plugins/bootstrap-table-pagejump/bootstrap-table-pagejump.css">
    <script src="${ctx}/libjs/plugins/bootstrap-table-pagejump/bootstrap-table-pagejump.js"></script>
    <%--<link rel="stylesheet" href="${ctx}/libjs/plugins/laydate/skins/laydate.css">--%>
    <link rel="stylesheet" href="${ctx}/libjs/plugins/laydate/laydate.css">
    <script src="${ctx}/libjs/plugins/laydate/laydate.js"></script>
    <link rel="stylesheet" href="${ctx}/libjs/plugins/bootStrap-table-fixed-column/bootstrap-table-fixed-columns.css">
    <script src="${ctx}/libjs/plugins/bootStrap-table-fixed-column/bootstrap-table-fixed-columns.js"></script>
    <style>
        .ibox-body #exampleModal input, .ibox-body #exampleModal select {
            width: 100% !important;
            height: 38px !important;
        }

        #exampleModal .btn, .btn-sm {
            margin-bottom: 0;
        }

        #exampleModal .form-group {
            padding-top: 0;
            margin-bottom: 5px;
        }

        .bootstrap-table .fixed-table-container .table thead th .th-inner {
            text-align: center !important;
        }
    </style>
</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function (i, origText) {
        return '<ol class="breadcrumb">' +
            '<li class="breadcrumb-item">' +
            '<a href="">主页</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a>会员管理</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<strong>超级会员购买记录</strong>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a href="javascript:window.history.back()"><i class="fa fa-times"></i> 返回</a>' +
            '</li>' +
            '</ol>';
    });
    var has_add = '';
    var has_edit = '';
    var has_delete = '';
    var MemberManager_supMemberRecord_look = false;
</script>

<body class="gray-bg" heigh="70%">
<div class="wrapper wrapper-content ">
    <div class="col-sm-12">
        <div class="ibox">
            <div class="ibox-body">
                <div class="row">
                    <input type="hidden" name="memberId" id="memberId" value="${memberId}">
                    <shiro:hasPermission name="MemberManager_supMemberRecord_reload">
                        <input id="beginTime" name="beginTime" type="text" class="form-control shortInput"
                               placeholder="开始时间">
                        <input id="endTime" name="endTime" type="text" class="form-control shortInput input-distance"
                               placeholder="结束时间">
                        <input id="mobile" name="mobile" type="text" class="form-control shortInput input-distance"
                               placeholder="手机号">
                        <select id="superLevelType" name="superLevelType" class="form-control shortInput input-distance"
                                placeholder="超级会员类型">
                            <option value="" selected>超级会员类型</option>
                            <option value="V1">月卡</option>
                            <option value="V2">季卡</option>
                            <option value="V3">年卡</option>
                        </select>
                        <select class="form-control shortInput input-distance" id="recordType" name="recordType">
                            <option value="">获得途径</option>
                            <option value="0">购买</option>
                            <option value="1">赠送</option>
                        </select>
                        <c:if test="${empty memberId}">
                            <select id="isValid" name="isValid" class="form-control shortInput input-distance"
                                    placeholder="使用状态">
                                <option value="-1">使用状态</option>
                                <option value="1">使用中</option>
                                <option value="2">已结束</option>
                                <option value="0">失效</option>
                            </select>
                        </c:if>
                        <button class="btn btn-success input-distance" onclick="ugsMemberSuperLevel.reLoad()">查询
                        </button>
                    </shiro:hasPermission>
                    <shiro:hasPermission name="MemberManager_supMemberRecord_update">
                        <button class="btn btn-danger input-distance" onclick="ugsMemberSuperLevel.batchFailure()">
                            强制失效
                        </button>
                        <button class="btn btn-info input-distance" onclick="ugsMemberSuperLevel.showModel()">超级会员赠送
                        </button>
                    </shiro:hasPermission>
                </div>
                <table id="exampleTable" data-mobile-responsive="true">
                </table>


                <%--  赠送会员模态框  --%>
                <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog"
                     aria-labelledby="exampleModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                        aria-hidden="true"></span></button>
                                <h4 class="modal-title" id="exampleModalLabel" data-dismiss="modal" aria-label="Close">
                                    关闭</h4>
                            </div>
                            <div class="modal-body">
                                <form id="contentForm" class="layui-form">
                                    <div class="form-group row">
                                        <label class="col-sm-4 col-form-label text-right">会员手机号*:</label>
                                        <div class="col-sm-8">
                                            <textarea class="form-control" id="phone" name="phone"
                                                      onmouseout="mouseOut()"></textarea>
                                            <span class="help-block m-b-none"><font color="#ff8c00" size="1">注:批量赠送手机号请用英文逗号隔开</font></span>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-sm-4 col-form-label text-right">超级会员卡类型*:</label>
                                        <div class="col-sm-8">
                                            <select id="levelType" name="levelType" class="form-control">
                                                <option value="V1">月卡</option>
                                                <option value="V2">季卡</option>
                                                <option value="V3">年卡</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-sm-4 col-form-label text-right">赠送天数*:</label>
                                        <div class="col-sm-8">
                                            <input class="form-control" id="days" name="days"
                                                   onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                                                   onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-sm-4 col-form-label text-right">管理员手机号*:</label>
                                        <div class="col-sm-6">
                                            <input class="form-control" id="" value="${moblie}" name="verificationCode"
                                                   disabled="disabled">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-sm-4 col-form-label text-right">管理员验证码*:</label>
                                        <div class="col-sm-4">
                                            <input class="form-control" autocomplete="off" id="verificationCode"
                                                   name="verificationCode"
                                                   disabled="disabled">
                                        </div>
                                        <div class="col-sm-4">
                                            <button type="button" class="btn btn-warning" id="sendVerificationCode"
                                                    onclick="ugsMemberSuperLevel.getAuthCode()">发送验证码
                                            </button>
                                        </div>
                                    </div>

                                </form>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                <button type="button" class="btn btn-success" id="giftMember">赠送</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<shiro:hasPermission name="MemberManager_supMemberRecord_look">
    <script>
        MemberManager_supMemberRecord_look = true;
    </script>
</shiro:hasPermission>
<script type="text/javascript">
    function mouseOut() {
        var phone = $("#phone").val();
        phone = phone.replace(/，/ig, ',');
        var arr = phone.split(",");
        $("#phone").val(arr)
    }

    // //日期范围限制
    var start = {
        elem: '#beginTime',
        format: 'YYYY-MM-DD hh:mm:ss',
        // theme: '#3195f0',
        // min: laydate.now(), //设定最小日期为当前日期
        // max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            $("#endTime").val("")
            end.min = datas
        }
    };
    var end = {
        elem: '#endTime',
        format: 'YYYY-MM-DD hh:mm:ss',
        // theme: '#3195f0',
        // min: laydate.now(),
        // max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
    laydate.skin('molv');//皮肤


    ugsMemberSuperLevel.init();

    layui.use(['form', 'jquery', 'tree', 'laydate', 'util'], function () {
        var form = layui.form;
        var $ = layui.jquery;

    })
</script>
</body>
</html>